<?php

class Webkul_Marketplacepartner_Block_Adminhtml_Sales_Order_Grid extends Mage_Adminhtml_Block_Sales_Order_Grid
{
	protected function _prepareCollection(){
		$collection = Mage::getResourceModel($this->_getCollectionClass());
		$collection1 = Mage::getResourceModel('marketplacepartner/productsales');
		$partner_product_id = $this->getRequest()->getParam('partner_product_id');
		        
        if ( $partner_product_id != null ) {
			$record = array();
        	$collection1->getSelect()->where('mageproid ="'.$partner_product_id.'"');
			foreach($collection1 as $record) {
				$record[] = $record['mageorderid'];
			}
			$collection->addAttributeToFilter('entity_id', array('in' => $record));
        }
        $this->setCollection($collection);
        return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
    }
}
?>
